home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 2.0 / Internet Publisher's Toolbox.iso / internet / ntserver / wtsource / wmessage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-16  |  2.5 KB  |  79 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE
  2.    No guarantees or restrictions.  See the readme file for the full standard
  3.    disclaimer.    
  4.    3.26.90
  5. */
  6.  
  7. /* Copyright (c) CNIDR (see ../COPYRIGHT) */
  8.  
  9.  
  10. /* wais-message.h
  11.  *
  12.  * This is the header outside of WAIS Z39.50 messages.  The header will be
  13.  * printable ascii, so as to be transportable.  This header will precede each
  14.  * Z39.50 APDU, or zero-length message if it is an ACK or NACK.  Be sure to
  15.  * change hdr_vers current value if you change the structure of the header.
  16.  *
  17.  * The characters in the header are case insensitive so that the systems from
  18.  * the past that only handle one case can at least read the header.
  19.  *
  20.  * 7.5.90 HWM - added constants
  21.  * 7/5/90 brewster added funtion prototypes and comments
  22.  * 11/30/90 HWM - went to version 2 (inits and typed retrieval)
  23.  */
  24.  
  25. #ifndef WMESSAGE_H
  26. #define WMESSAGE_H
  27.  
  28. #include "cdialect.h"
  29.  
  30. typedef struct wais_header {
  31.         char    msg_len[10];    /* length in bytes of following message */
  32.         char    msg_type;       /* type of message: 'z'=Z39.50 APDU,
  33.                                    'a'=ACK, 'n'=NACK */
  34.         char    hdr_vers;       /* version of this header, currently = '2' */
  35.         char    server[10];     /* name or address of server */
  36.         char    compression;    /* <sp>=no compression, 'u'=unix compress */
  37.         char    encoding;       /* <sp>=no encoding, 'h'=hexize, 
  38.                    'u'=uuencode */
  39.         char    msg_checksum;   /* XOR of every byte of message */
  40.         } WAISMessage;
  41.  
  42. #define HEADER_LENGTH     25    /* number of bytes needed to write a 
  43.                    wais-header (not sizeof(wais_header)) */
  44.  
  45. #define HEADER_VERSION     (long)'2'
  46.  
  47. /* message type */
  48. #define Z3950        'z'  
  49. #define ACK            'a'  
  50. #define    NAK            'n'  
  51.  
  52. /* compression */
  53. #define NO_COMPRESSION         ' ' 
  54. #define UNIX_COMPRESSION     'u' 
  55.  
  56. /* encoding */
  57. #define NO_ENCODING        ' '  
  58. #define HEX_ENCODING    'h'  /* Swartz 4/3 encoding */
  59. #define IBM_HEXCODING    'i'     /* same as h but uses characters acceptable for IBM mainframes */
  60. #define UUENCODE        'u'  
  61.  
  62. #ifdef __cplusplus
  63. /* declare these as C style functions */
  64. extern "C"
  65.     {
  66. #endif /* def __cplusplus */
  67.  
  68. void readWAISPacketHeader _AP((char* msgBuffer,WAISMessage *header_struct));
  69. long getWAISPacketLength _AP((WAISMessage* header));
  70. void writeWAISPacketHeader _AP((char* header,long dataLen,long type,
  71.                 char* server,long compression,    
  72.                 long encoding,long version));
  73.  
  74. #ifdef __cplusplus
  75.     }
  76. #endif /* def __cplusplus */
  77.  
  78. #endif /* ndef WMESSAGE_H */
  79.